from . import Base, ModelMixin
from sqlalchemy import Column, Integer, String, JSON, DATETIME, DateTime, Boolean
from datetime import datetime
from uuid import uuid4


class McpServer(Base, ModelMixin):
    __tablename__ = "mcp"
    id = Column(Integer, primary_key=True, autoincrement=True)
    name = Column(String(100))
    url = Column(String(200))
    transport = Column(String(50))
    command = Column(String(100))
    args = Column(JSON)
    headers = Column(JSON)
    env = Column(JSON)
    is_active = Column(Boolean, default=False)
    create_time = Column(DateTime, default=datetime.now)


class McpVersion(Base, ModelMixin):
    __tablename__ = "mcp_version"
    id = Column(Integer, primary_key=True, autoincrement=True)
    version = Column(String(100), default=lambda: uuid4().hex)
